<?php

include 'db-control/dbOpportunity.php';

$result = dbOpportunity::repPaid();
if (!$result)die("Could not complete query...");
$numRows = mysql_num_rows($result);
echo "<table width='100%' cellspacing=0><tr><td width='10%'></td><td><b>Pay Rate</b></td><td><b>Company</b></td><td><b>Title</b></td><td><b>Semester</b></td><td><b>Responsibilities</b></td><td width='10%'><b>Date Added</b></td></tr>";
echo "<tr><td colspan=7><hr /></td></tr>";

for ($x = 0; $x < $numRows; $x++) {
   $row = mysql_fetch_assoc($result);
   $id = $row['opportunityID'];
   $name = $row['organizationName'];
   $title = $row['title'];
   $semester = $row['semester'];
   $payRate = $row['payRate'];
   $resp = $row['responsibilities'];
   $date = $row['dateAdded'];
   $date = substr($date, 0, 10);
   if (strlen($desc) > 50) {
      $desc = substr($desc, 0, -(strlen($desc) - 50)) . "...";
   }
   if ($x % 2 == 0) {
      echo "<tr>";
   } else {
      echo "<tr bgcolor='#FBFBFB'>";
   }
   echo "<td align='center' valign='middle'><br /><form action='index.php' method='get'><input type='hidden' name='internship_id' value='$id'><input type='submit' value='View' class='submit' name='view_info' /></form></td>";
   echo "<td>$payRate</td>";
   echo "<td>$name</td>";
   echo "<td>$title</td>";
   echo "<td>$semester</td>";
   echo "<td>$resp</td>";
   echo "<td>$date</td>";
   echo "</tr>";
}
echo "</table>";
?>
